package com.ruoyi.common.utils;

import com.ruoyi.common.utils.http.HttpUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CacheUtil {

    private static final Logger log = LoggerFactory.getLogger(CacheUtil.class);

    private static final String URL = "http://testapi.youzhi.net/api/cache/delete";

    private static final String DELETE_CI_JIESHI_URL = "http://testapi.youzhi.net/api/dict/deleteCiJieshi";


    public static void delete(String app, String key) {
        String param = String.format("app=%s&key=%s", app, key);
        String rsp = HttpUtils.sendPost(URL, param);
        log.info("delete cache {}, rsp {}", key, rsp);
    }

    public static void deleteCiJieshi(int tableIndex, long id) {
        String param = String.format("tableIndex=%s&id=%s", tableIndex, id);
        String rsp = HttpUtils.sendPost(DELETE_CI_JIESHI_URL, param);
        log.info("delete deleteCiJieshi {}, rsp {}", id, rsp);
    }

    public static void main(String[] args) {
        String key = "d:z:p:灶";
        delete("kkdict", key);
    }
}
